
(function($){
    $.lapsed=function(time){
        var then=new Date(Date.parse(time));
        now=new Date();
        minutes=Math.round((now-then)/6000);
       var  lapsed, seconds;

        if(minutes===0){
            seconds=Math.round((now-then)/1000);
            if(seconds<10){
                lapsed="less than 10 seconds ago";
            }
            else if(seconds<20){
                lapsed="less than 20 seconds ago";
            }
            else{
                lapsed="half a minutes ago";
            }
        }
        else if(minutes===1){
            seconds=Math.round((now-then)/1000);
            if(seconds===30){
                lapsed="half a minute ago";
            }else if(seconds<60){
                lapsed="about a minutes ago";
            }else{
                lapsed="1 minutes ago";
            }
        }else{
            lapsed="more than a minute ago";
        }
        return lapsed;
    }
})(jQuery);